package com.dalin.platform.autocode.action;

import java.util.ArrayList;
import java.util.List;

import com.dalin.common.pager.PageInfo;
import com.dalin.framework.action.StrutsTwoAction;
import com.dalin.platform.loa.LoaConst;
import com.dalin.platform.loa.condition.LoaOperateHeaderCondition;
import com.dalin.platform.loa.model.LoaOperateHeaderEntity;
import com.dalin.platform.loa.service.OperateService;
import com.dalin.platform.loa.vo.LoaOperateHeaderVo;
/*****************************************************************************
 * @content: 类信息                                                                                                                                  *
 * @author : 那建林                                                                                                                                 *
 * @crtDate: 2011-03-10 09:51:15                                            *
 * @modDate: 2011-03-10 09:51:15                                            *
 * @version: 1.00                                                           *
 ****************************************************************************/
public class LoaOperateHeaderQueryAction extends StrutsTwoAction {
	private OperateService operateService; // 
    private String condStr; // 查询条件
    private int start; // 查询起始行数
    private int limit; // 每页显示行数

    public String execute()throws Exception {
        super.printInfo("", "===== this action begin");
        List<LoaOperateHeaderVo> voList = new ArrayList<LoaOperateHeaderVo>();
        try {
        	LoaOperateHeaderCondition cond = (LoaOperateHeaderCondition) getCond(
        			LoaOperateHeaderCondition.class, condStr, start, limit);
            List<LoaOperateHeaderEntity> dl = operateService.queryListByCond(cond.prepareParams());
            for (LoaOperateHeaderEntity enty: dl) {
            	LoaOperateHeaderVo vo = new LoaOperateHeaderVo();
            	vo.setLohId(enty.getLohId());
            	vo.setLabelName(enty.getGridHeaderEntity().getLabelName());
            	vo.setPropertyName(enty.getGridHeaderEntity().getPropertyName());
            	vo.setHeaderWidth(enty.getHeaderWidth());
            	vo.setOrderNumber(enty.getOrderNumber());
            	vo.setHiddenName(LoaConst.findItemName("visible", enty.getHidden()+""));
            	voList.add(vo);
            }
            PageInfo pageInfo = new PageInfo(voList.size(), voList);
            setResContent(pageInfo);
        } catch (Exception e) {
        	e.printStackTrace();
        }
        super.printInfo("", "===== this action end");
        return null;
    }


	public String getCondStr() {
		return condStr;
	}
	public void setCondStr(String condStr) {
		this.condStr = condStr;
	}
	public OperateService getOperateService() {
		return operateService;
	}
	public void setOperateService(OperateService operateService) {
		this.operateService = operateService;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
}
